home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Online / SpeakFreely / src / gsm / makefile < prev    next >
Makefile  |  2000-05-18  |  11KB  |  473 lines

  1. #
  2. # Copyright 1992 by Jutta Degener and Carsten Bormann, Technische
  3. # Universitaet Berlin.    See the accompanying file "COPYRIGHT" for
  4. # details.  THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE.
  5. #
  6.  
  7.  
  8. # Machine dependent flags you must configure to port
  9.  
  10. AUTO_SPARC_HACK = -DAUTO_SPARC_HACK
  11. # (Added by John Walker)  Automatically set -DUSE_FLOAT_MUL and
  12. #              -DFAST if compiling on sparc architecture.
  13.  
  14. SASR    = -DSASR
  15. ######### Define SASR if >> is a signed arithmetic shift (-1 >> 1 == -1)
  16.  
  17. MULHACK =
  18. ######### Define this if your host multiplies floats faster than integers,
  19. ######### e.g. on a SPARCstation.
  20.  
  21. FAST    =
  22. ######### Define together with USE_FLOAT_MUL to enable the GSM library's
  23. ######### approximation option for incorrect, but good-enough results.
  24.  
  25.  
  26. # Choose a compiler.  The code works both with ANSI and K&R-C.
  27. # Use -DNeedFunctionPrototypes to compile with, -UNeedFunctionPrototypes to
  28. # compile without, function prototypes in the header files.
  29. #
  30. # You can use the -DSTUPID_COMPILER to circumvent some compilers'
  31. # static limits regarding the number of subexpressions in a statement.
  32.  
  33. CC          = cc
  34. CCFLAGS       = -c -O
  35.  
  36. # CC        = /usr/lang/acc
  37. # CCFLAGS    = -c -O
  38.  
  39. # CC          = gcc
  40. # CCFLAGS      = -c -O2 -DNeedFunctionPrototypes=1
  41.  
  42. LD        = $(CC)
  43.  
  44. # LD        = gcc
  45. # LDFLAGS    =
  46.  
  47.  
  48. # If your compiler needs additional flags/libraries, regardless of
  49. # the source compiled, configure them here.
  50.  
  51. # CCINC = -I/usr/gnu/lib/gcc-2.1/gcc-lib/sparc-sun-sunos4.1.2/2.1/include
  52. ######### Includes needed by $(CC)
  53.  
  54. # LDINC = -L/usr/gnu/lib/gcc-2.1/gcc-lib/sparc-sun-sunos4.1.2/2.1
  55. ######### Library paths needed by $(LD)
  56.  
  57. # LDLIB = -lgcc
  58. ######### Additional libraries needed by $(LD)
  59.  
  60.  
  61. # Where do you want to install libraries, binaries, a header file
  62. # and the manual pages?
  63. #
  64. # Leave INSTALL_ROOT empty (or just don't execute "make install") to
  65. # not install gsm and toast outside of this directory.
  66.  
  67. INSTALL_ROOT    =
  68.  
  69. # Where do you want to install the gsm library, header file, and manpages?
  70. #
  71. # Leave GSM_INSTALL_ROOT empty to not install the GSM library outside of
  72. # this directory.
  73.  
  74. GSM_INSTALL_ROOT = $(INSTALL_ROOT)
  75. GSM_INSTALL_LIB = $(GSM_INSTALL_ROOT)/lib
  76. GSM_INSTALL_INC = $(GSM_INSTALL_ROOT)/inc
  77. GSM_INSTALL_MAN = $(GSM_INSTALL_ROOT)/man/man3
  78.  
  79.  
  80. # Where do you want to install the toast binaries and their manpage?
  81. #
  82. # Leave TOAST_INSTALL_ROOT empty to not install the toast binaries outside
  83. # of this directory.
  84.  
  85. TOAST_INSTALL_ROOT      = $(INSTALL_ROOT)
  86. TOAST_INSTALL_BIN = $(TOAST_INSTALL_ROOT)/bin
  87. TOAST_INSTALL_MAN = $(TOAST_INSTALL_ROOT)/man/man1
  88.  
  89. #  Other tools
  90.  
  91. SHELL        = /bin/sh
  92. LN        = ln
  93. BASENAME    = basename
  94. AR        = ar
  95. ARFLAGS     = cr
  96. RMFLAGS     = -f
  97. FIND        = find
  98. COMPRESS    = compress
  99. COMPRESSFLAGS    = 
  100. # RANLIB    = true
  101. RANLIB        = ranlib
  102.  
  103. #
  104. #    You shouldn't have to configure below this line if you're porting.
  105.  
  106.  
  107. # Local Directories
  108.  
  109. ROOT    = .
  110. ADDTST    = $(ROOT)/add-test
  111. TST    = $(ROOT)/tst
  112. MAN    = $(ROOT)/man
  113. BIN    = $(ROOT)/bin
  114. SRC    = $(ROOT)/src
  115. LIB    = $(ROOT)/lib
  116. TLS    = $(ROOT)/tls
  117. INC    = $(ROOT)/inc
  118.  
  119. # Flags
  120.  
  121. DEBUG    = -DNDEBUG
  122. ######### Remove -DNDEBUG to enable assertions.
  123.  
  124. CFLAGS    = $(CCFLAGS) $(SASR) $(DEBUG) $(MULHACK) $(FAST) $(AUTO_SPARC_HACK) $(CCINC) -I$(INC)
  125. ######### It's $(CC) $(CFLAGS)
  126.  
  127. LFLAGS    = $(LDFLAGS) $(LDINC)
  128. ######### It's $(LD) $(LFLAGS)
  129.  
  130.  
  131. # Targets
  132.  
  133. LIBGSM    = $(LIB)/libgsm.a
  134.  
  135. TOAST    = $(BIN)/toast
  136. UNTOAST = $(BIN)/untoast
  137. TCAT    = $(BIN)/tcat
  138.  
  139. # Headers
  140.  
  141. GSM_HEADERS =    $(INC)/gsm.h
  142.  
  143. HEADERS =    $(INC)/proto.h        \
  144.         $(INC)/unproto.h    \
  145.         $(INC)/config.h     \
  146.         $(INC)/private.h    \
  147.         $(INC)/gsm.h        \
  148.         $(INC)/toast.h        \
  149.         $(TLS)/taste.h
  150.  
  151. # Sources
  152.  
  153. GSM_SOURCES =    $(SRC)/add.c        \
  154.         $(SRC)/code.c        \
  155.         $(SRC)/debug.c        \
  156.         $(SRC)/decode.c     \
  157.         $(SRC)/long_term.c    \
  158.         $(SRC)/lpc.c        \
  159.         $(SRC)/preprocess.c    \
  160.         $(SRC)/rpe.c        \
  161.         $(SRC)/gsm_destroy.c    \
  162.         $(SRC)/gsm_decode.c    \
  163.         $(SRC)/gsm_encode.c    \
  164.         $(SRC)/gsm_explode.c    \
  165.         $(SRC)/gsm_implode.c    \
  166.         $(SRC)/gsm_create.c    \
  167.         $(SRC)/gsm_print.c    \
  168.         $(SRC)/gsm_option.c    \
  169.         $(SRC)/short_term.c    \
  170.         $(SRC)/table.c
  171.  
  172. TOAST_SOURCES = $(SRC)/toast.c        \
  173.         $(SRC)/toast_lin.c    \
  174.         $(SRC)/toast_ulaw.c    \
  175.         $(SRC)/toast_alaw.c    \
  176.         $(SRC)/toast_audio.c
  177.  
  178. SOURCES =    $(GSM_SOURCES)        \
  179.         $(TOAST_SOURCES)    \
  180.         $(ADDTST)/add_test.c    \
  181.         $(TLS)/bitter.c     \
  182.         $(TLS)/bitter.dta    \
  183.         $(TLS)/taste.c        \
  184.         $(TLS)/sweet.c        \
  185.         $(TST)/cod2lin.c    \
  186.         $(TST)/cod2txt.c    \
  187.         $(TST)/gsm2cod.c    \
  188.         $(TST)/lin2cod.c    \
  189.         $(TST)/lin2txt.c
  190.  
  191. # Object files
  192.  
  193. GSM_OBJECTS =    $(SRC)/add.o        \
  194.         $(SRC)/code.o        \
  195.         $(SRC)/debug.o        \
  196.         $(SRC)/decode.o     \
  197.         $(SRC)/long_term.o    \
  198.         $(SRC)/lpc.o        \
  199.         $(SRC)/preprocess.o    \
  200.         $(SRC)/rpe.o        \
  201.         $(SRC)/gsm_destroy.o    \
  202.         $(SRC)/gsm_decode.o    \
  203.         $(SRC)/gsm_encode.o    \
  204.         $(SRC)/gsm_explode.o    \
  205.         $(SRC)/gsm_implode.o    \
  206.         $(SRC)/gsm_create.o    \
  207.         $(SRC)/gsm_print.o    \
  208.         $(SRC)/gsm_option.o    \
  209.         $(SRC)/short_term.o    \
  210.         $(SRC)/table.o
  211.  
  212. TOAST_OBJECTS = $(SRC)/toast.o        \
  213.         $(SRC)/toast_lin.o    \
  214.         $(SRC)/toast_ulaw.o    \
  215.         $(SRC)/toast_alaw.o    \
  216.         $(SRC)/toast_audio.o
  217.  
  218. OBJECTS =     $(GSM_OBJECTS) $(TOAST_OBJECTS)
  219.  
  220. # Manuals
  221.  
  222. GSM_MANUALS =    $(MAN)/gsm.3        \
  223.         $(MAN)/gsm_explode.3    \
  224.         $(MAN)/gsm_option.3    \
  225.         $(MAN)/gsm_print.3
  226.  
  227. TOAST_MANUALS = $(MAN)/toast.1
  228.  
  229. MANUALS =    $(GSM_MANUALS) $(TOAST_MANUALS) $(MAN)/bitter.1
  230.  
  231. # Other stuff in the distribution
  232.  
  233. STUFF =     ChangeLog            \
  234.         INSTALL         \
  235.         MACHINES        \
  236.         MANIFEST        \
  237.         Makefile        \
  238.         README            \
  239.         $(ADDTST)/add_test.dta    \
  240.         $(TLS)/bitter.dta    \
  241.         $(TST)/run
  242.  
  243.  
  244. # Install targets
  245.  
  246. GSM_INSTALL_TARGETS =    \
  247.         $(GSM_INSTALL_LIB)/libgsm.a        \
  248.         $(GSM_INSTALL_INC)/gsm.h        \
  249.         $(GSM_INSTALL_MAN)/gsm.3        \
  250.         $(GSM_INSTALL_MAN)/gsm_explode.3    \
  251.         $(GSM_INSTALL_MAN)/gsm_option.3     \
  252.         $(GSM_INSTALL_MAN)/gsm_print.3
  253.  
  254. TOAST_INSTALL_TARGETS = \
  255.         $(TOAST_INSTALL_BIN)/toast        \
  256.         $(TOAST_INSTALL_BIN)/tcat        \
  257.         $(TOAST_INSTALL_BIN)/untoast        \
  258.         $(TOAST_INSTALL_MAN)/toast.1
  259.  
  260.  
  261. # Default rules
  262.  
  263. .c.o:
  264.         $(CC) $(CFLAGS) $?
  265.         @-mv `$(BASENAME) $@` $@ > /dev/null 2>&1
  266.  
  267. # Target rules
  268.  
  269. all:        $(LIBGSM) $(TOAST) $(TCAT) $(UNTOAST)
  270.         @-echo $(ROOT): Done.
  271.  
  272. tst:        $(TST)/lin2cod $(TST)/cod2lin $(TOAST) $(TST)/test-result
  273.         @-echo tst: Done.
  274.  
  275. addtst:     $(ADDTST)/add $(ADDTST)/add_test.dta
  276.         $(ADDTST)/add < $(ADDTST)/add_test.dta > /dev/null
  277.         @-echo addtst: Done.
  278.  
  279. misc:        $(TLS)/sweet $(TLS)/bitter    \
  280.             $(TST)/lin2txt $(TST)/cod2txt $(TST)/gsm2cod
  281.         @-echo misc: Done.
  282.  
  283. install:    toastinstall gsminstall
  284.         @-echo install: Done.
  285.  
  286.  
  287. # The basic API: libgsm
  288.  
  289. $(LIBGSM):    $(LIB) $(GSM_OBJECTS)
  290.         -rm $(RMFLAGS) $(LIBGSM)
  291.         $(AR) $(ARFLAGS) $(LIBGSM) $(GSM_OBJECTS)
  292.         -$(RANLIB) $(LIBGSM)
  293.  
  294.  
  295. # Toast, Untoast and Tcat -- the compress-like frontends to gsm.
  296.  
  297. $(TOAST):    $(BIN) $(TOAST_OBJECTS) $(LIBGSM)
  298.         $(LD) $(LFLAGS) -o $(TOAST) $(TOAST_OBJECTS) $(LIBGSM) $(LDLIB)
  299.  
  300. $(UNTOAST):    $(BIN) $(TOAST)
  301.         -rm $(RMFLAGS) $(UNTOAST)
  302.         $(LN) $(TOAST) $(UNTOAST)
  303.  
  304. $(TCAT):    $(BIN) $(TOAST)
  305.         -rm $(RMFLAGS) $(TCAT)
  306.         $(LN) $(TOAST) $(TCAT)
  307.  
  308.  
  309. # The local bin and lib directories
  310.  
  311. $(BIN):
  312.         if [ ! -d $(BIN) ] ; then mkdir $(BIN) ; fi
  313.  
  314. $(LIB):
  315.         if [ ! -d $(LIB) ] ; then mkdir $(LIB) ; fi
  316.  
  317.  
  318. # Installation
  319.  
  320. gsminstall:
  321.         -if [ x"$(GSM_INSTALL_ROOT)" != x ] ; then    \
  322.             make $(GSM_INSTALL_TARGETS) ;    \
  323.         fi
  324.  
  325. toastinstall:
  326.         -if [ x"$(TOAST_INSTALL_ROOT)" != x ]; then    \
  327.             make $(TOAST_INSTALL_TARGETS);    \
  328.         fi
  329.  
  330. gsmuninstall:
  331.         -if [ x"$(GSM_INSTALL_ROOT)" != x ] ; then    \
  332.             rm $(RMFLAGS) $(GSM_INSTALL_TARGETS) ;    \
  333.         fi
  334.  
  335. toastuninstall:
  336.         -if [ x"$(TOAST_INSTALL_ROOT)" != x ] ; then    \
  337.             rm $(RMFLAGS) $(TOAST_INSTALL_TARGETS); \
  338.         fi
  339.  
  340. $(TOAST_INSTALL_BIN)/toast:    $(TOAST)
  341.         -rm $@
  342.         cp $(TOAST) $@
  343.         chmod 755 $@
  344.  
  345. $(TOAST_INSTALL_BIN)/untoast:    $(TOAST_INSTALL_BIN)/toast
  346.         -rm $@
  347.         ln $? $@
  348.  
  349. $(TOAST_INSTALL_BIN)/tcat:    $(TOAST_INSTALL_BIN)/toast
  350.         -rm $@
  351.         ln $? $@
  352.  
  353. $(TOAST_INSTALL_MAN)/toast.1:    $(MAN)/toast.1
  354.         -rm $@
  355.         cp $? $@
  356.         chmod 444 $@
  357.  
  358. $(GSM_INSTALL_MAN)/gsm.3:    $(MAN)/gsm.3
  359.         -rm $@
  360.         cp $? $@
  361.         chmod 444 $@
  362.  
  363. $(GSM_INSTALL_MAN)/gsm_option.3:    $(MAN)/gsm_option.3
  364.         -rm $@
  365.         cp $? $@
  366.         chmod 444 $@
  367.  
  368. $(GSM_INSTALL_MAN)/gsm_explode.3:    $(MAN)/gsm_explode.3
  369.         -rm $@
  370.         cp $? $@
  371.         chmod 444 $@
  372.  
  373. $(GSM_INSTALL_MAN)/gsm_print.3: $(MAN)/gsm_print.3
  374.         -rm $@
  375.         cp $? $@
  376.         chmod 444 $@
  377.  
  378. $(GSM_INSTALL_INC)/gsm.h:    $(INC)/gsm.h
  379.         -rm $@
  380.         cp $? $@
  381.         chmod 444 $@
  382.  
  383. $(GSM_INSTALL_LIB)/libgsm.a:    $(LIBGSM)
  384.         -rm $@
  385.         cp $? $@
  386.         chmod 444 $@
  387.  
  388.  
  389. # Distribution
  390.  
  391. dist:        gsm-1.0.tar.Z
  392.         @echo dist: Done.
  393.  
  394. gsm-1.0.tar.Z:    $(STUFF) $(SOURCES) $(HEADERS) $(MANUALS)
  395.         (    cd $(ROOT)/..;                \
  396.             tar cvf - `cat $(ROOT)/gsm-1.0/MANIFEST \
  397.                 | sed '/^#/d'`            \
  398.         ) | $(COMPRESS) $(COMPRESSFLAGS) > $(ROOT)/gsm-1.0.tar.Z
  399.  
  400. # Clean
  401.  
  402. uninstall:    toastuninstall gsmuninstall
  403.         @-echo uninstall: Done.
  404.  
  405. semi-clean:
  406.         -rm $(RMFLAGS)    */*.o            \
  407.             $(TST)/lin2cod $(TST)/lin2txt    \
  408.             $(TST)/cod2lin $(TST)/cod2txt    \
  409.             $(TST)/gsm2cod            \
  410.             $(TST)/*.*.*
  411.         -$(FIND) . \( -name core -o -name foo \) \
  412.             -print | xargs rm $(RMFLAGS)
  413.  
  414. clean:    semi-clean
  415.         -rm $(RMFLAGS) $(LIBGSM) $(ADDTST)/add        \
  416.             $(TOAST) $(TCAT) $(UNTOAST)    \
  417.             $(ROOT)/gsm-1.0.tar.Z
  418.  
  419.  
  420. # Two tools that helped me generate gsm_encode.c and gsm_decode.c,
  421. # but aren't generally needed to port this.
  422.  
  423. $(TLS)/sweet:    $(TLS)/sweet.o $(TLS)/taste.o
  424.         $(LD) $(LFLAGS) -o $(TLS)/sweet \
  425.             $(TLS)/sweet.o $(TLS)/taste.o $(LDLIB)
  426.  
  427. $(TLS)/bitter:    $(TLS)/bitter.o $(TLS)/taste.o
  428.         $(LD) $(LFLAGS) -o $(TLS)/bitter \
  429.             $(TLS)/bitter.o $(TLS)/taste.o $(LDLIB)
  430.  
  431.  
  432. # Run $(ADDTST)/add < $(ADDTST)/add_test.dta to make sure the
  433. # basic arithmetic functions work as intended.
  434.  
  435. $(ADDTST)/add:    $(ADDTST)/add_test.o
  436.         $(LD) $(LFLAGS) -o $(ADDTST)/add $(ADDTST)/add_test.o $(LDLIB)
  437.  
  438.  
  439. # Various conversion programs between linear, text, .gsm and the code
  440. # format used by the tests we ran (.cod).  We paid for the test data,
  441. # so I guess we can't just provide them with this package.  Still,
  442. # if you happen to have them lying around, here's the code.
  443. # You can use gsm2cod | cod2txt independently to look at what's
  444. # coded inside the compressed frames, although this shouldn't be
  445. # hard to roll on your own using the gsm_print() function from
  446. # the API.
  447.  
  448.  
  449. $(TST)/test-result:    $(TST)/lin2cod $(TST)/cod2lin $(TOAST) $(TST)/run
  450.             ( cd $(TST); ./run ) 
  451.  
  452. $(TST)/lin2txt:     $(TST)/lin2txt.o $(LIBGSM)
  453.             $(LD) $(LFLAGS) -o $(TST)/lin2txt \
  454.                 $(TST)/lin2txt.o $(LIBGSM) $(LDLIB)
  455.  
  456. $(TST)/lin2cod:     $(TST)/lin2cod.o $(LIBGSM)
  457.             $(LD) $(LFLAGS) -o $(TST)/lin2cod \
  458.                 $(TST)/lin2cod.o $(LIBGSM) $(LDLIB)
  459.  
  460. $(TST)/gsm2cod:     $(TST)/gsm2cod.o $(LIBGSM)
  461.             $(LD) $(LFLAGS) -o $(TST)/gsm2cod \
  462.                 $(TST)/gsm2cod.o $(LIBGSM) $(LDLIB)
  463.  
  464. $(TST)/cod2txt:     $(TST)/cod2txt.o $(LIBGSM)
  465.             $(LD) $(LFLAGS) -o $(TST)/cod2txt \
  466.                 $(TST)/cod2txt.o $(LIBGSM) $(LDLIB)
  467.  
  468. $(TST)/cod2lin:     $(TST)/cod2lin.o $(LIBGSM)
  469.             $(LD) $(LFLAGS) -o $(TST)/cod2lin \
  470.                 $(TST)/cod2lin.o $(LIBGSM) $(LDLIB)
  471.